/**
 * 
 */
package quq.missq.utils;

import java.util.Calendar;
import java.util.Date;

/**
 * 星座计算
 * @author langhsu
 */
public class AstroUtils {
	private static String[] astros = new String[] { "摩羯座", "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座" };
	private static int[] days = new int[] { 20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22 }; 
	
	public static String star(Date time) {
		if (time == null) {
			return "";
		}
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(time);
		
		int month = calendar.get(Calendar.MONTH) + 1;
		int day = calendar.get(Calendar.DATE);
		System.out.println("month:" + month + ", day:" + day);
		return star(month, day);
	}
	
	public static String star(int month, int day) {
		return day < days[month - 1] ? astros[month - 1] : astros[month]; 
	}
//	public static void main(String[] args) throws ParseException {
//		Date time = DateUtils.parseDate("2015-12-06", new String[] {"yyyy-MM-dd"});
//		System.out.println(star(time));
//	}
}
